<?php
namespace app\admin\controller;
use think\Db;
class Balance
{
    public function __construct()
    {
        Admin_auth(); 
    }
    //展现充值金额数据
    public function index()
   {  
     //遍历数据库查询所有已充值未充值
     $cid=input('get.cid');//城市id
     if(!empty($cid)){
         $where=['cid'=>$cid];
      }else{
         $where="";
      }
     //数据参数
      $pages=pages('user_balance',$where,input('get.page'));//数据页数
      $data= Db::table("user_balance")->whereIn('aid',session('aid'))->where($where)->limit($pages['limit'])->order('id desc')->select();   
      foreach($data as $k=>$v){
       //user
        $data[$k]['name']=Db::table("user")->where('id',$v['uid'])->value('name');
        $data[$k]['area']=Db::table('area')->where('id',$v['aid'])->value('name');  
      }
      
      
      return view('',['data'  => $data,'pages' => $pages['pages']]);
    }
    
    
    
    
    
    
    
    
    
    
}

